package com.cxyzy.imageviewdemo

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        localImageBtn.setOnClickListener { startActivity<LocalImageActivity>() }
        networkImageBtn.setOnClickListener { startActivity<NetworkImageActivity>() }
    }

    private inline fun <reified T : Activity> Context.startActivity() =
        startActivity(Intent(this, T::class.java))
}
